<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>分辨率</title>
</head>
<style>
  *{
    margin:0;
    padding:0;
    box-sizing: border-box;
  }
  body,html{
    width:100vw;
    height: 100vh;
  }
  .wrap{
    position: relative;
    width:100%;
    height: 100%;
    background: rgb(252, 77, 8);
  }

  #text{
    position: absolute;
    top:50%;
    left:50%;
    transform: translate(-50%,-50%);
    color:#fff;
    font-size: 80px;
  }
</style>
<body>
  <div class="wrap">
    <h1 id="text"></h1>
  </div>
</body>
</html>
<script>
  function resize(){
    document.getElementById('text').innerHTML =  document.body.clientWidth+' X '+document.body.clientHeight;
  }
  resize()
  window.addEventListener('resize', resize);
</script>